import axios from '@/utils/request'

/**
 * 获取-部门列表
 * @returns 部门列表对象
 */
export const getDepartInfoAPI = () =>
  axios({
    url: '/company/department',
    method: 'GET'
  })

/**
 * 获取-部门负责人列表
 * @returns promise对象
 */
export const getUserSimpleAPI = () =>
  axios({
    url: '/sys/user/simple',
    method: 'GET'
  })

/**
 * 新增-部门
 * @returns promise对象
 */
export const addDepartmentAPI = (data) =>
  axios({
    url: '/company/department',
    method: 'POST',
    data
  })

/**
 * 获取-部门详情
 * @param {*} id 部门id
 * @returns
 */
export const getDepartDetailAPI = (id) =>
  axios({
    url: `/company/department/${id}`,
    method: 'GET'
  })

/**
 * 修改-部门详情
 * @param {*} id 部门id
 * @param {*} data 修改后的form表单
 * @returns
 */
export const changeDepartDetailAPI = (id, data) =>
  axios({
    url: `/company/department/${id}`,
    method: 'PUT',
    data
  })

/**
 * 删除部门
 * @param {*} id 部门id
 * @returns
 */
export const delDepartDetailAPI = (id) =>
  axios({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
